package com.dal.rpc.consumer.controller;

import com.dal.rpc.api.HelloService;
import com.dal.rpc.api.domain.User;
import com.dal.rpc.core.annotation.RpcReference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;


/**
 * @program: dal-springboot
 * @description: 测试通讯
 * @author: jian
 * @create: 2021-11-22 12:39
 */
@RestController
@RequestMapping("/hello")
public class HelloController {

    @RpcReference(providerName = "provider")
    private HelloService helloService;

    @GetMapping("/test")
    public String hello(){
        return helloService.sysHello();
    }

    @GetMapping("/user")
    public List<User> findAllUser(){
        List<User> all = helloService.findAll();
        return all;
    }
}
